/*
 * Copyright (C) Michael Opitz
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA
 */
#ifndef CLIENT_H
#define CLIENT_H

#include "interpreter.h"
#include "dom.h"

#include <boost/shared_ptr.hpp>

#include <list>
#include <string> 
#include <iostream>

using namespace std;

/**
 * \brief This namespace contains all model-classes.
 * \author Michael Opitz
 */
namespace model {
	/** 
	 * \brief This class represents a music-client
	 */
	class client {
	public:
		client() {}
		/** 
		 * \brief client creates a client from an dom-node
		 * 
		 * \param node is the node from which the client should be
		 * created
		 */
		client(const model::dom &node);
		/** 
		 * \brief client creates a client.
		 * 
		 * \param n is the name of the client
		 * \param i is a list of interpreters, the client should contain
		 */
		client(const string &n, const list<model::interpreter> &i) 
		: _name(n), _interpreters(i) {}
		~client() {}

		/** 
		 * \brief parse parses a dom-tree to a client
		 * 
		 * \param node is the dom-node which should be parsed.
		 */
		void parse(const model::dom &node);

		/** 
		 * \brief set_name sets the name of the client.
		 */
		void set_name(const string &n) {_name = n;}
		/** 
		 * \brief get_name returns the name of the client.
		 */
		const string& get_name() const {return _name;}

		/** 
		 * \brief set_interpreters sets the interpreters of the client
		 */
		void set_interpreters(const list<model::interpreter> i)
		{
			_interpreters = i;
		}
		/** 
		 * \brief get_interpreters returns the interpreters of the
		 * client
		 */
		const list<model::interpreter>& get_interpreters() const 
		{
			return _interpreters;
		}
		/** 
		 * \brief get_interpreters returns the interpreters of the
		 * client
		 */
		list<model::interpreter>& get_interpreters()
		{
			return _interpreters;
		}

		/** 
		 * \brief print prints the client. For debug purposes only.
		 */
		void print() const;
		/** 
		 * \brief to_xml prints the xml-structure of the client
		 */
		string to_xml() const;
	private:
		string _name;
		list<model::interpreter> _interpreters;
	};
}

#endif
